package com.ayu.scalalearn.chapter05

/**
  * @Author 徐林玉
  * @Description CloseAndKeli
  * @Date 2022/7/27 16:59
  * @Version 1.0
  */
object Test01ClosureAndCurring {


  def addA(a: Int): Int => Int = {

    def addB(b: Int): Int = {
      //这里能用a参数叫做函数式编程里面的闭包的概念
      a + b
    }

    addB
  }

  def main(args: Array[String]): Unit = {
    var sum = addA(1)(2)

    println(sum)


    //函数柯里化
    def addCurrying(a: Int)(b: Int): Int = {

      a + b
    }

    println(addCurrying(2)(3))
  }


}
